/* 此文件用于给外层调用，减少体积 */
import { NameSpace } from 'utils/index';

const ns = NameSpace('projectFiles');
export const UPDATE_SELECTED_TYPE = ns('UPDATE_SELECTED_TYPE');

// 在projectFile内路由改变时，接收路由层发出的通知更新 selectedType 和 resourcePath
export function updateSetSelectedType(pageInfo) {
  return (dispatch) => {
    dispatch({
      type: UPDATE_SELECTED_TYPE,
      data: {
        selectedType: pageInfo.resourceSubject.subject,
        resourcePath: pageInfo.resourceSubject.path,
        selectedKeys: [pageInfo.resourceSubject.path],
      },
    });
  };
}
